<?php
/**
 * Extend Zend_Application_Resource_Log
 * Auto select translate file by locale
 * 
 * @copyright  Copyright (c) 2011 Ricky Feng (http://code.google.com/p/rphp4zf)
 * @license    New BSD License
 */

class Mediad2_Application_Resource_Log extends Zend_Application_Resource_Log
{
    public function init()
    {
    	if(!is_dir(LOGCACHE_PATH)) mkdir(LOGCACHE_PATH);
    	
    	$options = $this->getOptions();
    	$options["stream"]["writerParams"]["stream"] = LOGCACHE_PATH . WEB_TITLE.'[' . date('Ymd') . '].log';
    	
		//初始化
		$log = Zend_Log::factory($options);
				
		//放入注册表
		Zend_Registry::set('log', $log);
		
		return $log;

    }
}

